
import React, { Component } from 'react'

// 加载样式
import style from './index.scss'

//加载组件
import { Checkbox } from 'antd-mobile'

//定义
// const AgreeItem = Checkbox.AgreeItem;

export default class OrderList extends Component {
    constructor(props) {
        super(props);
    }
    componentWillMount() {

    }

    toUrl(url,data) {
        sessionStorage.setItem('passCache',JSON.stringify(data))
        this.context.router.push(url);
    }

    render() {
        let data = this.props.data;
        return (
            <div className={style.orderList}>
                <div className={style.container} onClick={()=>{this.toUrl('passInformation/enCode',data)}}>
                    <div className={style.example+' '+'border_bottom_1'}>
                        <div className={style.type}>
                            <span>{data.orderTitle}</span>
                            <img src="./images/icon_to_r.png" alt=""/>
                        </div>
                        <div className={style.priceBox}>
                          {
	                            data.items&&data.items.map((e,i)=>{
	                                if(e.category==1){
	                                    return <div key={i} className={style.price}>
                                          <span>香港，{
	                                            e.times == 1?'三月一次':e.times == 2?'三月二次': e.times == 3?'三月多次':
                                              e.times== 4?'一年一次': e.times == 5?'一年二次':e.times == 6?'一年多次':null
                                            }</span>
                                          <span>￥{e.endorseFee/100||''}</span>
                                      </div>
                                  }else {
	                                    return <div key={i} className={style.price}>
                                          <span>澳门，{
	                                          e.times == 1?'三月一次':e.times == 2?'三月二次': e.times == 3?'三月多次':
				                                          e.times== 4?'一年一次': e.times == 5?'一年两次':e.times == 6?'一年多次':null
                                          }</span>
                                          <span>￥{e.endorseFee/100||''}</span>
                                      </div>
                                  }

                              })
                          }

                        <div className={style.price}>
                            <span>邮政速递服务费用{data.needInvoice==1?'（已申请发票）':''}</span>
                            <span>￥{data.totalServiceAmount/100||''}</span>
                        </div>
                        </div>
                    </div>

                    <div className={style.example+' '+'border_bottom_1'}>
                        <div className={style.total}>
                            <span>合计</span>
                            <span>￥{data.orderAmount/100||''}</span>
                        </div>
                    </div>

                    <div className={style.example}>
                        <div className={style.address}>
                            <div><span>收件人：{data.eOrderAddress&&data.eOrderAddress.contactName}，{data.eOrderAddress&&data.eOrderAddress.cellNum}</span></div>
                            <div>{data.eOrderAddress&&data.eOrderAddress.fullAddr.replace(null,'')}</div>
                        </div>
                    </div>
                </div>
            </div>

        );
    }
}
//使用context
OrderList.contextTypes = {
	router: React.PropTypes.object.isRequired
};


OrderList.defaultProps = {

};